import 'dart:io';

void startTest() async {
  try {
    var process = await Process.start('dir', []);
    var exitCode = process.exitCode;
    print('exit code: $exitCode');
  } catch (e) {
    print(e.toString());
    stderr.write(e.toString());
    stderr.write('\n');
  }
}

void runTest() async {
  var result = await Process.run('git', ['status']);
  print('${result.stdout}');
}

void runNotepadTest(){
  Process.run('notepad', ['']).then((ProcessResult results) {
    print(results.stdout);
  });
}

void thenTest(){
  Process.run('Nslookup', ['www.baidu.com']).then((ProcessResult results) {
    print(results.stdout);
  });
  Process.run('start', ['www.baidu.com'],runInShell: true).then((ProcessResult results) {
    print(results.stdout);
  });
}

void startBrowserTest()async{
  await Process.runSync('start', ['http://localhost:8888']);
}

void main() {
  thenTest();
  // runNotepadTest();
  // startTest();
  // runTest();
  // startBrowserTest();
}
